<?php
include('../config.php');

$name = $_GET['name'];
$price = $_GET['price'];
$num = $_GET['num'];

$sql = "insert into shop (name,price,num) values ('$name',$price,$num)";

$res = mysql_query($sql);

// $res = false;

if ($res) {
    echo json_encode(array(
        "code" => 200,
        "msg" => "添加成功"
    ));
} else {
    echo json_encode(array(
        "code" => 500,
        "msg" => "网络错误，请重试"
    ));
}

// 断开数据库连接，不写也可以，自动也会断开
mysql_close();

?>